package com.gwc.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

// 在这里配置了注解，形成了url映射就无需在web.xml中再进行配置，两者会冲突
@WebServlet(urlPatterns = {"/testWebServlet","/testWebServlet1","/testWebServlet2"})
public class ServletTest extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter writer = resp.getWriter();
        writer.write("测试@WebServlet注解");
    }
}
